﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

namespace SEVN.Web.Framework.Modules.Header
{
    public partial class Header0101 : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            XmlReader xml = XmlReader.Create(Server.MapPath(@"Xml/Banner.xml"));

            xml.ReadStartElement("banner");
            xml.ReadStartElement("title");
            string title = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadStartElement("subtitle");
            string subTitle = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadStartElement("logo");
            string logo = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadStartElement("backgroundimage");
            string bgImage = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadStartElement("flash");
            string flash = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadEndElement();

            string header = "";

            if (string.IsNullOrEmpty(flash))
            {
                header = "<div id='banner' style='background-image: url(" + bgImage + ");' >";
                if (!string.IsNullOrEmpty(logo))
                    header += "<img id='logo' src='" + logo + "' alt='Logo' />";
                if (!string.IsNullOrEmpty(title))
                    header += "<div id='title'>" + title + "</div>";
                if (!string.IsNullOrEmpty(subTitle))
                    header += "<div id='subtitle'>" + subTitle + "</div>";
                header += "</div>";
            }
            else
            {
                header = "<embed width='960' height='120' menu='true' loop='true' play='true' src='" + flash + "' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent' />";
            }

            litHeader.Text = header;

        }
    }
}